<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns="http://www.w3.org/1999/xhtml" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">

	<xsl:template name="listOfUsers">
		<table width="100%" cellpadding="10" border="0">
			<xsl:for-each select="users/user">
				<xsl:variable name="curPos"><xsl:value-of select="position()"/></xsl:variable>
				<xsl:if test="$curPos mod 3 = 1">
					<tr>
						<xsl:apply-templates select="../user[position() = $curPos]"/>
						<xsl:apply-templates select="../user[position() = $curPos+1]"/>
						<xsl:apply-templates select="../user[position() = $curPos+2]"/>
					</tr>
				</xsl:if>
			</xsl:for-each>
		</table>
	</xsl:template>

</xsl:stylesheet>